import os

def generate_random_password(length):
    random_bytes = os.urandom(length) # 生成随机字节
    random_password = ''.join(f'{byte:02x}' for byte in random_bytes) # 将字节转换为十六进制字符串
    return random_password